{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0",
   "metadata": {},
   "source": [
    "<a href=\"https://githubtocolab.com/gee-community/geemap/blob/master/docs/notebooks/123_sentinel1_timelapse.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\"/></a>\n",
    "\n",
    "**Creating Sentinel-1 SAR imagery timelapse**\n",
    "\n",
    "Uncomment the following line to install [geemap](https://geemap.org) if needed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# !pip install -U geemap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import ee\n",
    "import geemap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3",
   "metadata": {},
   "outputs": [],
   "source": [
    "Map = geemap.Map()\n",
    "Map"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4",
   "metadata": {},
   "source": [
    "Pan and zoom to an area of interest and draw a rectangle on the map."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5",
   "metadata": {},
   "outputs": [],
   "source": [
    "roi = Map.user_roi\n",
    "if roi is None:\n",
    "    roi = ee.Geometry.BBox(117.1132, 3.5227, 117.2214, 3.5843)\n",
    "    Map.addLayer(roi)\n",
    "    Map.centerObject(roi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6",
   "metadata": {},
   "outputs": [],
   "source": [
    "timelapse = geemap.sentinel1_timelapse(\n",
    "    roi,\n",
    "    out_gif=\"sentinel1.gif\",\n",
    "    start_year=2019,\n",
    "    end_year=2019,\n",
    "    start_date=\"04-01\",\n",
    "    end_date=\"08-01\",\n",
    "    frequency=\"day\",\n",
    "    vis_params={\"min\": -30, \"max\": 0},\n",
    "    palette=\"Greys\",\n",
    "    frames_per_second=3,\n",
    "    title=\"Sentinel-1 Timelapse\",\n",
    "    add_colorbar=True,\n",
    "    colorbar_bg_color=\"gray\",\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7",
   "metadata": {},
   "outputs": [],
   "source": [
    "geemap.show_image(timelapse)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8",
   "metadata": {},
   "source": [
    "![](https://i.imgur.com/FlhvI46.gif)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
